#!/bin/sh
args=`getopt c: $*`
if [ $? -ne 0 ]; then echo 'Usage: ...'; exit 2; fi
set -- $args
for i; do
  case "$i"
  in
    -c)
      cc="$2"; shift;
      shift;;
    --)
    shift; break;;
  esac
done
error=0
cd /tmp
for x in `jot 100 1 100`; do
  if [ -z "$cc" ]; then
    host=ftp$x.FreeBSD.org
  else
    host=ftp$x.$cc.FreeBSD.org
  fi
  host $host > /dev/null 2>&1
  if [ $? -ne 0 ]; then
    error=`expr $error + 1`
    if [ $error -gt 2 ]; then exit; fi
    continue
  fi
  echo $host
  fetch -T 1 -o /dev/null ftp://$host/pub/FreeBSD/development/CVSup/ezm3/ezm3-1.0-src.tar.bz2
done
